<template lang="html">
  <div class="header">
     <h1>{{message}}</h1>
     <a href="javascript:;" class="go-back"  v-on:click="goBack">返回</a>
  </div>
</template>

<script>
export default {
  name: 'header',
  props:["message"],
  methods: {
    goBack:function () {
      window.history.back();
      this.$emit("listenToChildEvent","this message is from child");
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.header{
  width: 100%;
  height: 45px;
  line-height: 45px;
  text-align: center;
  background: rgba(243, 240, 240, 0.98);
}
h1{
    font-size: 16px;
    font-weight: 400;
    color: #333;
}
.header .go-back {
  width: 2rem;
  height: 2rem;
  text-align: center;
  color: #ccc;
  font-size: 0.8rem;
  float: left;
  line-height: 2rem;
  margin-left: 1rem;
  position: absolute;
  left: 0;
  top: 0;
}
</style>
